# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=ruby-net-pop
_gemname=net-pop
# Keep version in sync with "Bundled gems" (https://stdgems.org) for the
# packaged Ruby version.
pkgver=0.1.1
pkgrel=0
pkgdesc="Ruby client library for POP3"
url="https://github.com/ruby/net-pop"
arch="noarch"
license="BSD-2-Clause AND Ruby"
depends="ruby"
checkdepends="ruby-rake ruby-test-unit"
makedepends="ruby-rdoc"
subpackages="$pkgname-doc"
source="https://github.com/ruby/net-pop/archive/v$pkgver/$_gemname-$pkgver.tar.gz
	gemspec.patch
	"
builddir="$srcdir/$_gemname-$pkgver"

prepare() {
	default_prepare
	sed -i '/require .bundler/d' Rakefile
}

build() {
	gem build $_gemname.gemspec
}

check() {
	rake test
}

package() {
	local gemdir="$pkgdir/$(ruby -e 'puts Gem.default_dir')"

	gem install \
		--local \
		--install-dir "$gemdir" \
		--ignore-dependencies \
		--document ri \
		--verbose \
		$_gemname

	# Remove unnessecary files
	cd "$gemdir"
	rm -rf build_info cache extensions plugins
}

doc() {
	pkgdesc="$pkgdesc (ri docs)"

	amove "$(ruby -e 'puts Gem.default_dir')"/doc
}

sha512sums="
9a6a03cf8ce19711a1f9318910f0cb01ec5282695e986b68657fafc289ef32c084f2a9f5a038114f550ef1553bc99c8dda094191492b503c82a37a4a71124eb2  net-pop-0.1.1.tar.gz
3f801d8fe740714cd75e6e0f1e1a967a2b9e3a3927d8b8040ca477ae0dc483b5670356bb18e375aaeedf008f0b7f04e6369e17f90adcbc416171c76933f04300  gemspec.patch
"
